package cn.hg.jbsa.admin.controller.system.validator;

import com.jfinal.core.Controller;

import cn.hg.jboot.core.validator.BaseValidator;

/**
 * @author 胡高
 * @date 2022/02/12
 */
public class JbsaResourceValidator extends BaseValidator {

    /* (non-Javadoc)
     * @see com.jfinal.validate.Validator#handleError(com.jfinal.core.Controller)
     */
    @Override
    protected void handleError(Controller c) {}

    /* (non-Javadoc)
     * @see com.jfinal.validate.Validator#validate(com.jfinal.core.Controller)
     */
    @Override
    protected void validate(Controller c) {
        this.validateRequired("bean.parentId", "parentIdMsg", "必须填写上级资源！");
        this.validateRequired("bean.type", "typeMsg", "必须填写资源类型！");
        this.validateString("bean.name", 2, 50, "nameMsg", "名称必须填写2到50长度的字符！");
        this.validateInteger("bean.sortNum", 0, Short.MAX_VALUE, "sortNumMsg",
            "排序号的范围必须是[0 - " + Short.MAX_VALUE + "]！");
        this.validateRequired("bean.status", "statusMsg", "必须填写状态！");
    }

}
